/* ========================================================================== */
/*   OperationController.h    		                                          */
/*   (c) 2012 Team 7 Hogeschool Utrecht ICT TI                                */
/*		Lars Stolwijk, Gerben Boot, Guido van Hienen, Marcel Boelen			  */
/*                                                                            */
/*   Starts and stops the entire game. At start gives Log command to clear 	  */
/*		the log														          */
/* ========================================================================== */

#ifndef __OperationController
#define __OperationController

#include "pRTOS.h"
#include "SoundController.h"
#include "GameHandler.h"

//***************************************************************************
//
// class OperationController
//
//! Starts and stops the entire game. At start gives Log command to clear the log
//
//***************************************************************************

class OperationController : public RTOS::task {
	public:	
		//! Constructor
		OperationController(int prio, SoundController * soundController, GameHandler * gameHandler, Log * log) : RTOS::task(prio, 
			"OperationControlTask"), theSoundController(soundController), theGameHandler(gameHandler), theLog(log), PlayEndGameFlag( this, "PlayEndGameFlag"){}
		
		//! Sets the PlayEndGame flag
		void PlayEndGame();

	private:
		enum State { STANDBY, RUNNING };
		State CurrentState;

		SoundController * theSoundController;
		GameHandler * theGameHandler;
		Log * theLog;
		
		RTOS::flag PlayEndGameFlag;

		//! The main method
		void main();
};

#endif
